//app.js
App({
  tabbarindex:0,    //底部导航索引
  imgurl:'https://xte.sxzmw.com/asset/img/',          //图片地址
	paytype:false,
  onLaunch: function () {
    
  },
	onShow:function(){
		var that = this;
		that.request({
			url: 'index/program/LoginStatus',
			method: 'post',
			type: 0,
			success: function (res) {
				
				if(res.data == 0){
					that.paytype  = false
				}else{
					console.log(res.data)
					that.paytype  = true
				}
			}
		})
	},
  navTo(e){
    wx.navigateTo({url: e,})
  },
  navlaunch(e){
    wx.reLaunch({url:e})
  },
  base_url:'https://xte.sxzmw.com/',
  get(param){
    let that= this
    return new Promise(function(resolve,reject){
      wx.request({
        url: that.base_url+ param.url, // 仅为示例，并非真实的接口地址
        data: param.data,
        header: {
          'content-type': 'application/json' // 默认值
        },
        success(res) {
          // console.log(res.data)
          if (res.statusCode==200){
            resolve(res.data)
          }
        }
      })
    })
  },
  post(){

  },
  request:function(data){
    if(data.type == 1){
      var userid = wx.getStorageSync('userid')
      data.data.uid = userid;
    }
    let that = this;
    wx.request({
      url: that.base_url + data.url,
      method: data.method,
      data: data.data,
      success:function(res){
        data.success && data.success(res.data, res.statusCode);
      }
    })
  },
  globalData: {
    userInfo: null
  }
})